<template>
  <div class="commission-nav-tabs">
    <router-link v-for="(tab, index) in tabs" :key="index" :to="tab.path" class="commission-nav-tab"
      :class="{ 'active': isActive(tab.path) }">
      <i :class="tab.icon"></i>
      <span>{{ tab.title }}</span>
    </router-link>
  </div>
</template>

<script lang="ts" setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute();

// 定义导航标签
const tabs = ref([
  // {
  //   title: '佣金概览',
  //   path: '/agent/commission/overview',
  //   icon: 'fas fa-chart-pie'
  // },
  {
    title: '佣金明细',
    path: '/agent/commission/records',
    icon: 'fas fa-list-alt'
  },
  {
    title: '佣金提现',
    path: '/agent/commission/withdraw',
    icon: 'fas fa-money-bill-wave'
  },
  // {
  //   title: '佣金规则',
  //   path: '/agent/commission/rules',
  //   icon: 'fas fa-scroll'
  // }
]);

// 检查当前路由是否激活
const isActive = (path: string) => {
  return route.path === path;
};
</script>

<style lang="scss" scoped>
.commission-nav-tabs {
  display: flex;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
  overflow: hidden;
}

.commission-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  color: #666;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;

  i {
    font-size: 20px;
    margin-bottom: 8px;
  }

  span {
    font-size: 14px;
  }

  &:hover {
    color: #4A6CF7;
    background-color: rgba(74, 108, 247, 0.05);
  }

  &.active {
    color: #4A6CF7;
    background-color: rgba(74, 108, 247, 0.1);

    &::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 40%;
      height: 3px;
      background-color: #4A6CF7;
      border-radius: 3px 3px 0 0;
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .commission-nav-tab {
    padding: 12px 4px;

    i {
      font-size: 16px;
      margin-bottom: 4px;
    }

    span {
      font-size: 12px;
    }
  }
}
</style>
